/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * GUIAdministrador.java
 *
 * Created on 18/11/2009, 08:01:49 PM
 */

package scapi.gui;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.net.MalformedURLException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.NoSuchElementException;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.colorchooser.AbstractColorChooserPanel;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.view.JasperViewer;
import scapi.reportes.ReporteSCAPI;
import scapi.servidor.servidores.ServidorReporte;
import scapi.utilerias.BD;
import scapi.utilerias.ServidorFactory;

/**
 *
 * @author emmanuel
 */
public class GUIAdministrador extends javax.swing.JFrame {

    private JPanel main;
    private Vector<String> pVentanasAtras;
    private Vector<String> pVentanasAdelante;
    private String vtnActual;
    private ServidorReporte reportes;

    /** Creates new form GUIAdministrador */
    public GUIAdministrador() {
        initComponents();
         main = new JPanel(new GridLayout(1,0));
         main.add(new AdministradorAdministrarUsuario());


        getContentPane().add(main, java.awt.BorderLayout.CENTER);

        pVentanasAdelante = new Vector<String>();
        pVentanasAtras = new Vector<String>();

        vtnActual = "home";
        try{

        reportes = (ServidorReporte) ServidorFactory.obtenerServidor(ServidorFactory.ServidorReportes);
        }catch(Exception e){
            e.printStackTrace();
        }



        pack();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        btnNuevo = new javax.swing.JButton();
        jSeparator5 = new javax.swing.JToolBar.Separator();
        btnAtras = new javax.swing.JButton();
        btnAdelante = new javax.swing.JButton();
        jSeparator6 = new javax.swing.JToolBar.Separator();
        btnBusqueda = new javax.swing.JButton();
        jSeparator7 = new javax.swing.JToolBar.Separator();
        btnUsuario = new javax.swing.JButton();
        btnSucursal = new javax.swing.JButton();
        btnReloj = new javax.swing.JButton();
        btnBoleta = new javax.swing.JButton();
        jSeparator3 = new javax.swing.JToolBar.Separator();
        btnInventario = new javax.swing.JButton();
        btnCarteraV = new javax.swing.JButton();
        btnRUsuario = new javax.swing.JButton();
        btnRBoleta = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JSeparator();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenuItem9 = new javax.swing.JMenuItem();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenuItem16 = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenuItem14 = new javax.swing.JMenuItem();
        jMenu6 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setLayout(new java.awt.GridLayout(1, 0));

        jToolBar1.setBorder(null);
        jToolBar1.setFloatable(false);
        jToolBar1.setRollover(true);

        btnNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/filenew.png"))); // NOI18N
        btnNuevo.setToolTipText("Nuevo");
        btnNuevo.setFocusable(false);
        btnNuevo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnNuevo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevoActionPerformed(evt);
            }
        });
        jToolBar1.add(btnNuevo);
        jToolBar1.add(jSeparator5);

        btnAtras.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/back32.png"))); // NOI18N
        btnAtras.setToolTipText("Atras");
        btnAtras.setFocusable(false);
        btnAtras.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnAtras.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnAtras.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAtrasActionPerformed(evt);
            }
        });
        jToolBar1.add(btnAtras);

        btnAdelante.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/Next32.png"))); // NOI18N
        btnAdelante.setToolTipText("Adelante");
        btnAdelante.setFocusable(false);
        btnAdelante.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnAdelante.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnAdelante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAdelanteActionPerformed(evt);
            }
        });
        jToolBar1.add(btnAdelante);
        jToolBar1.add(jSeparator6);

        btnBusqueda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/find.png"))); // NOI18N
        btnBusqueda.setToolTipText("Buscar");
        btnBusqueda.setFocusable(false);
        btnBusqueda.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnBusqueda.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(btnBusqueda);
        jToolBar1.add(jSeparator7);

        btnUsuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/user32.png"))); // NOI18N
        btnUsuario.setToolTipText("Usuarios");
        btnUsuario.setFocusable(false);
        btnUsuario.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnUsuario.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUsuarioActionPerformed(evt);
            }
        });
        jToolBar1.add(btnUsuario);

        btnSucursal.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/casa32.png"))); // NOI18N
        btnSucursal.setToolTipText("Sucursal");
        btnSucursal.setFocusable(false);
        btnSucursal.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnSucursal.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnSucursal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSucursalActionPerformed(evt);
            }
        });
        jToolBar1.add(btnSucursal);

        btnReloj.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/product32.png"))); // NOI18N
        btnReloj.setToolTipText("Productos");
        btnReloj.setFocusable(false);
        btnReloj.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnReloj.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnReloj.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRelojActionPerformed(evt);
            }
        });
        jToolBar1.add(btnReloj);

        btnBoleta.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/block32.png"))); // NOI18N
        btnBoleta.setToolTipText("Boletas");
        btnBoleta.setFocusable(false);
        btnBoleta.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnBoleta.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnBoleta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBoletaActionPerformed(evt);
            }
        });
        jToolBar1.add(btnBoleta);
        jToolBar1.add(jSeparator3);

        btnInventario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/Inventario32.png"))); // NOI18N
        btnInventario.setFocusable(false);
        btnInventario.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnInventario.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnInventario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInventarioActionPerformed(evt);
            }
        });
        jToolBar1.add(btnInventario);

        btnCarteraV.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/cartera32.png"))); // NOI18N
        btnCarteraV.setFocusable(false);
        btnCarteraV.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnCarteraV.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnCarteraV.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCarteraVActionPerformed(evt);
            }
        });
        jToolBar1.add(btnCarteraV);

        btnRUsuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/pignorante32.png"))); // NOI18N
        btnRUsuario.setFocusable(false);
        btnRUsuario.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnRUsuario.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnRUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRUsuarioActionPerformed(evt);
            }
        });
        jToolBar1.add(btnRUsuario);

        btnRBoleta.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/Boleta32.png"))); // NOI18N
        btnRBoleta.setFocusable(false);
        btnRBoleta.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnRBoleta.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnRBoleta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRBoletaActionPerformed(evt);
            }
        });
        jToolBar1.add(btnRBoleta);

        jPanel1.add(jToolBar1);

        getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);

        jMenu1.setText("Archivo");

        jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/home2.png"))); // NOI18N
        jMenuItem1.setText("Inicio");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem1);

        jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/exit.png"))); // NOI18N
        jMenuItem2.setText("Salir");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem2);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Edicion");

        jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/back.png"))); // NOI18N
        jMenuItem3.setText("Atras");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem3);

        jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/forward.png"))); // NOI18N
        jMenuItem4.setText("Adelante");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem4);
        jMenu2.add(jSeparator1);

        jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/editcut.png"))); // NOI18N
        jMenuItem5.setText("Copiar");
        jMenu2.add(jMenuItem5);

        jMenuItem6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/editpaste.png"))); // NOI18N
        jMenuItem6.setText("Pegar");
        jMenu2.add(jMenuItem6);
        jMenu2.add(jSeparator2);

        jMenuItem7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/borrar.png"))); // NOI18N
        jMenuItem7.setText("Borrar");
        jMenu2.add(jMenuItem7);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Buscar");
        jMenuBar1.add(jMenu3);

        jMenu4.setText("Administrador");

        jMenuItem8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/user16.png"))); // NOI18N
        jMenuItem8.setText("Usuarios");
        jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem8ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem8);

        jMenuItem9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/casa16.png"))); // NOI18N
        jMenuItem9.setText("Sucursales");
        jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem9ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem9);

        jMenuItem10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/product16.png"))); // NOI18N
        jMenuItem10.setText("Productos");
        jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem10ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem10);

        jMenuItem16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/block16.png"))); // NOI18N
        jMenuItem16.setText("Boletas");
        jMenuItem16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem16ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem16);

        jMenuBar1.add(jMenu4);

        jMenu5.setText("Reportes");

        jMenuItem11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/inventario16.png"))); // NOI18N
        jMenuItem11.setText("Inventario");
        jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem11ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem11);

        jMenuItem13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/cartera16.png"))); // NOI18N
        jMenuItem13.setText("Cartera Vencida");
        jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem13ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem13);

        jMenuItem12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/clientes.png"))); // NOI18N
        jMenuItem12.setText("Personas");
        jMenuItem12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem12ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem12);

        jMenuItem14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scapi/imagenes/block16.png"))); // NOI18N
        jMenuItem14.setText("Boleta");
        jMenuItem14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem14ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem14);

        jMenuBar1.add(jMenu5);

        jMenu6.setText("Ayuda");
        jMenuBar1.add(jMenu6);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnSucursalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSucursalActionPerformed
        try {
            actualizarPanel(new AdministradorAdministrarSucursal());
            pVentanasAtras.add(vtnActual);
            this.vtnActual = "sucursal";
        } catch (Exception ex) {
           ex.printStackTrace();
        }
        
    }//GEN-LAST:event_btnSucursalActionPerformed

    private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoActionPerformed
        
    }//GEN-LAST:event_btnNuevoActionPerformed

    private void btnAtrasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAtrasActionPerformed
         try{
            String ultimo = pVentanasAtras.lastElement();
            pVentanasAdelante.add(vtnActual);
            pVentanasAtras.remove(ultimo);
            this.vtnActual= ultimo;

            System.out.println(ultimo);

            if(ultimo.equals("home")){
                actualizarPanel(new CajeroMainPanel());
            }else if (ultimo.equals("usuario")){
                actualizarPanel(new AdministradorAdministrarUsuario() );
            }else if(ultimo.equals("sucursal")){
                try {
                    actualizarPanel(new AdministradorAdministrarSucursal());
                } catch (RemoteException ex) {
                    Logger.getLogger(GUIAdministrador.class.getName()).log(Level.SEVERE, null, ex);
                } catch (NotBoundException ex) {
                    Logger.getLogger(GUIAdministrador.class.getName()).log(Level.SEVERE, null, ex);
                } catch (MalformedURLException ex) {
                    Logger.getLogger(GUIAdministrador.class.getName()).log(Level.SEVERE, null, ex);
                } catch (SQLException ex) {
                    Logger.getLogger(GUIAdministrador.class.getName()).log(Level.SEVERE, null, ex);
                }
            }else if(ultimo.equals("prenda")){
                actualizarPanel(new AdministrarDatosPrenda());
            }else if(ultimo.equals("boleta")){
                actualizarPanel(new CajeroMainPanel());
            }
        }catch(NoSuchElementException e){
            JOptionPane.showMessageDialog(this, "No hay mas ventanas");
        }catch(Exception e){
            e.printStackTrace();
        }

    }//GEN-LAST:event_btnAtrasActionPerformed

    private void btnAdelanteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAdelanteActionPerformed
       try{
            String ultimo = pVentanasAdelante.lastElement();

            System.out.println("Adelante a "+ultimo);
            pVentanasAdelante.remove(ultimo);
            pVentanasAtras.add(ultimo);

             if(ultimo.equals("home")){
                    actualizarPanel(new CajeroMainPanel());
                }else if (ultimo.equals("usuario")){
                    actualizarPanel(new AdministradorAdministrarUsuario() );
                }else if(ultimo.equals("sucursal")){
                try {
                    actualizarPanel(new AdministradorAdministrarSucursal());
                } catch (RemoteException ex) {
                    Logger.getLogger(GUIAdministrador.class.getName()).log(Level.SEVERE, null, ex);
                } catch (NotBoundException ex) {
                    Logger.getLogger(GUIAdministrador.class.getName()).log(Level.SEVERE, null, ex);
                } catch (MalformedURLException ex) {
                    Logger.getLogger(GUIAdministrador.class.getName()).log(Level.SEVERE, null, ex);
                } catch (SQLException ex) {
                    Logger.getLogger(GUIAdministrador.class.getName()).log(Level.SEVERE, null, ex);
                }
                }else if(ultimo.equals("prenda")){
                    actualizarPanel(new AdministrarDatosPrenda());
                }else if(ultimo.equals("boleta")){
                    actualizarPanel(new CajeroMainPanel());
                }
        }catch(NoSuchElementException e){
            JOptionPane.showMessageDialog(this, "No hay mas ventanas");
        }catch(Exception e){
            e.printStackTrace();
        }
    }//GEN-LAST:event_btnAdelanteActionPerformed

    private void btnUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUsuarioActionPerformed
        actualizarPanel(new AdministradorAdministrarUsuario());
        pVentanasAtras.add(vtnActual);
        this.vtnActual = "usuario";
    }//GEN-LAST:event_btnUsuarioActionPerformed

    private void btnRelojActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRelojActionPerformed
        actualizarPanel(new AdministrarDatosPrenda());
        pVentanasAtras.add(vtnActual);
        this.vtnActual = "prenda";
    }//GEN-LAST:event_btnRelojActionPerformed

    private void jMenuItem16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem16ActionPerformed
        btnBoletaActionPerformed(evt);
    }//GEN-LAST:event_jMenuItem16ActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed

        btnNuevoActionPerformed(evt);
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed

        System.exit(0);
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed

        btnAtrasActionPerformed(evt);
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed

        btnAdelanteActionPerformed(evt);
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed

        btnUsuarioActionPerformed(evt);
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem8ActionPerformed

    private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed

        btnSucursalActionPerformed(evt);
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem9ActionPerformed

    private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed

        btnRelojActionPerformed(evt);
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem10ActionPerformed

    private void btnBoletaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBoletaActionPerformed
        actualizarPanel(new CajeroMainPanel());
        pVentanasAtras.add(vtnActual);
        this.vtnActual = "boleta";
    }//GEN-LAST:event_btnBoletaActionPerformed

    private void btnRUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRUsuarioActionPerformed
        try {
            JasperPrint print = reportes.getReporte("Persona.jasper", new HashMap<String, String>());
            JasperViewer.viewReport(print,false);

        } catch (SQLException ex) {
            Logger.getLogger(GUIAdministrador.class.getName()).log(Level.SEVERE, null, ex);
        } catch (JRException ex) {
            Logger.getLogger(GUIAdministrador.class.getName()).log(Level.SEVERE, null, ex);
        } catch (RemoteException ex){
            ex.printStackTrace();
        }



    }//GEN-LAST:event_btnRUsuarioActionPerformed

    private void btnInventarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInventarioActionPerformed
        DialogoGenerico dig = new DialogoGenerico(this,"Inventario Reportes", true, new AdministradorReporteInventario());
        dig.setVisible(true);
        // TODO add your handling code here:
    }//GEN-LAST:event_btnInventarioActionPerformed

    private void btnCarteraVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCarteraVActionPerformed
        DialogoGenerico dig = new DialogoGenerico(this,"Inventario Reportes", true, new AdministradorReporteCarteraV());
        dig.setVisible(true);

        // TODO add your handling code here:
    }//GEN-LAST:event_btnCarteraVActionPerformed

    private void btnRBoletaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRBoletaActionPerformed
        DialogoGenerico dig = new DialogoGenerico(this,"Inventario Reportes", true, new AdministradorReporteEmpenios());
        dig.setVisible(true);
        // TODO add your handling code here:
    }//GEN-LAST:event_btnRBoletaActionPerformed

    private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed

        btnInventarioActionPerformed(evt);


        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem11ActionPerformed

    private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem13ActionPerformed

        btnCarteraVActionPerformed(evt);
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem13ActionPerformed

    private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem12ActionPerformed


        btnRUsuarioActionPerformed(evt);
    }//GEN-LAST:event_jMenuItem12ActionPerformed

    private void jMenuItem14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem14ActionPerformed

        btnRBoletaActionPerformed(evt);
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem14ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new GUIAdministrador().setVisible(true);
            }
        });
    }

        public static void iniciar() {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new GUIAdministrador().setVisible(true);
            }
        });
    }

     public void actualizarPanel(JPanel panel){
        this.main.remove(0);
        main.add(panel);
        main.revalidate();
        pack();


    }

    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAdelante;
    private javax.swing.JButton btnAtras;
    private javax.swing.JButton btnBoleta;
    private javax.swing.JButton btnBusqueda;
    private javax.swing.JButton btnCarteraV;
    private javax.swing.JButton btnInventario;
    private javax.swing.JButton btnNuevo;
    private javax.swing.JButton btnRBoleta;
    private javax.swing.JButton btnRUsuario;
    private javax.swing.JButton btnReloj;
    private javax.swing.JButton btnSucursal;
    private javax.swing.JButton btnUsuario;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem14;
    private javax.swing.JMenuItem jMenuItem16;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JToolBar.Separator jSeparator3;
    private javax.swing.JToolBar.Separator jSeparator5;
    private javax.swing.JToolBar.Separator jSeparator6;
    private javax.swing.JToolBar.Separator jSeparator7;
    private javax.swing.JToolBar jToolBar1;
    // End of variables declaration//GEN-END:variables

}
